package com.bobi.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.bobi.entity.Promotion;
import com.bobi.entity.PurchaseOrder;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @author wenyuan
 * @version 1.0
 * @date 2023/7/4
 * @since 8
 */
@Mapper
public interface PurchaseOrderMapper extends BaseMapper<PurchaseOrder> {
    @Select("${sql} limit #{offset}, #{limit}")
    List<PurchaseOrder> getPageBySql(@Param("sql") String sql, @Param("offset") int offset, @Param("limit") int limit);

    @Select("SELECT count(*) FROM bobi_goods go, bobi_purchase_order ord WHERE go.id = ord.good_id")
    int getCountBySql(@Param("sql") String sql);


}